package com.cmict.data.system.mq.producer.permission;

import com.cmict.data.framework.mq.core.RedisMQTemplate;
import com.cmict.data.system.mq.message.permission.MenuRefreshMessage;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Menu 菜单相关消息的 Producer
 */
//@Component
//public class MenuProducer extends AbstractBusProducer {
//
//    /**
//     * 发送 {@link MenuRefreshMessage} 消息
//     */
//    public void sendMenuRefreshMessage() {
//        publishEvent(new MenuRefreshMessage(this, getBusId(), selfDestinationService()));
//    }
//
//}
@Component
public class MenuProducer {
    Lock lock=new ReentrantLock();//ReentrantLock：lock接口的实现类之一
    @Resource
    private RedisMQTemplate redisMQTemplate;

    /**
     * 发送 {@link MenuRefreshMessage} 消息
     */
    public void sendMenuRefreshMessage() {
        MenuRefreshMessage message = new MenuRefreshMessage();
        redisMQTemplate.send(message);
    }

}